package org.reenscape.skill;
import org.reenscape.*;
import org.reenscape.model.*;
import org.reenscape.lib.*;
import org.reenscape.updater.*;
public class Firemaking {

					public void Light(int id, PacketParser p3){
						switch(id){
							case 1511:/*NORMAL*/		backend(1, id, 40, "Normal", p3);	break;
							case 1513:/*MAGIC*/		backend(75, id, 303, "Magic", p3);	break;
							case 2862:/*ACHEY*/		backend(1, id, 40, "Achey", p3);	break;
							case 1515:/*YEW*/		backend(60, id, 202, "Yew", p3);	break;
							case 1517:/*MAPLE*/		backend(45, id, 135, "Maple", p3);	break;
							case 6332:/*MAHOG*/		backend(50, id, 158, "Mahogany", p3);	break;
							case 6333:/*TEAK*/		backend(35, id, 105, "Teak", p3);	break;
							case 1519:/*WILLOW*/		backend(30, id, 90, "Willow", p3);	break;
							case 1521:/*OAK*/		backend(15, id, 60, "Oak", p3);		break;
						}
					}
					
					public void backend(int required, int log, int xp, String logname, PacketParser p3){
						if(p3.playerLevel[11] >= required) {
							p3.deleteItem(log, p3.GetItemSlot(log), 1);
							p3.Animation(733);
							p3.sendMessage("You light a fire.");
							//p3.placeGlobalObject(p3.absX, p3.absY, 2732, 0, 10);
							CreateNewFire(p3);
							p3.FWGoalX = p3.currentX - 1;
							p3.FWGoalY = p3.currentY;
							p3.resetWalkingQueue();
							p3.addToWalkingQueue(p3.FWGoalX, p3.FWGoalY);
							p3.ForceWalk = true;
							p3.addSkillXP(xp, 11);
						} else {
							p3.sendMessage("You need a firemaking level of "+required+" to burn "+logname+" logs.");
						}
					}
					
					public void CreateNewFire(PacketParser p3) {
						for(int i = 0; i < ObjectUpdater.MaxObjects; i++) {
							if (ObjectUpdater.ObjectFireID[i] == -1) {
								ObjectUpdater.ObjectFireID[i] = 2732;
								ObjectUpdater.ObjectFireX[i] = p3.absX;
								ObjectUpdater.ObjectFireY[i] = p3.absY;
								ObjectUpdater.ObjectFireH[i] = p3.heightLevel;
								ObjectUpdater.ObjectFireMaxDelay[i] = ObjectUpdater.FireDelay + (ObjectUpdater.FireGianDelay * 6);
								break;
							}
						}
					}
					
}